<template>
	<div class='content'>

	</div>
</template>

<script>
	import {
		login
	} from '@/service/getData';
	import {
		setStore,
		getStore,
		getDefault
	} from '@/assets/config/mUtils';
	import * as dd from 'dingtalk-jsapi';
	import {
		corpId
	} from '@/assets/config/env';
	export default {
		data() {
			return {}
		},
		created() {
			var that = this;
			dd.ready(function() {
				dd.runtime.permission.requestAuthCode({
					corpId: corpId, // 企业id
					onSuccess: function(info) {
						let code = info.code // 通过该免登授权码可以获取用户身份
						console.log(code)
						login({
							code
						}).then(res => {
							if (res.data.userId) {
								setStore('user_id', res.data.userId);
								if (that.$route.query && that.$route.query.query) {
									that.$router.push('/backlog');
								} else {
									that.$router.push('/home');
								}
							}

						})
					}
				});
			});
		},
		mounted() {

		},

		components: {},
	}
</script>
